package com.linkhub.oms.data.sync.api.wms.domain.response;

import com.alibaba.fastjson.annotation.JSONField;
import com.linkhub.oms.common.util.QtOptionalUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @Description: SyncProductResponse
 * @Author: Jaycle
 * @Date: 2024/6/12 21:15
 * @Version: 1.0
 */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class SyncProductResponse extends WmsBaseResponse implements Serializable {


    /**
     * response
     */
    @JSONField(name = "response")
    private Response response;


    @Override
    protected String getFlag() {
        return QtOptionalUtil.of(response)
                .map(Response::getFlag)
                .orElse(null);
    }

    /**
     * Response
     */
    @Data
    @NoArgsConstructor
    public static class Response {
        /**
         * flag
         */
        @JSONField(name = "flag")
        private String flag;
        /**
         * code
         */
        @JSONField(name = "code")
        private String code;
        /**
         * message
         */
        @JSONField(name = "message")
        private String message;
        /**
         * itemId
         */
        @JSONField(name = "itemId")
        private String itemId;
    }
}
